<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      border: 0;
      list-style: none;
    }
    ul {
      position: absolute;
      width: 200px;
      top: 0;
      left: 0;
      border: 1px solid #000;
      display: none;
    }
    li {
      border: 1px solid #f0f0f0;
      line-height: 30px;      
    }
  </style>
</head>
<body>
  <ul>
    <li>添加</li>
    <li>删除</li>
    <li>通知</li>
  </ul>
  <script>
    var ul = document.querySelector("ul");
    document.addEventListener("contextmenu", function(e) {
      e.preventDefault(); // 阻止浏览器默认行为，不会出现浏览器默认的右键显示行为
      ul.style.display = "block";
      ul.style.top = e.pageY + "px";
      ul.style.left = e.pageX + "px";
    })
  </script>
</body>
</html>